<?php
/**
 * Created by PhpStorm.
 * User: zhao shou qiang
 * Date: 2017/12/18 0018
 * Time: 15:49
 */


use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;
use backend\assets\AppAsset;

/* @var $this yii\web\View */
/* @var $searchModel common\models\ProjectInvestigationSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

AppAsset::register($this);


$this->title = '尽调报告';
//$this->params['breadcrumbs'][] = $this->title;

$this->registerCssFile('@web/css/paging.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/select2.min.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/projectInvestigation/assessment.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);

AppAsset::addScript($this, '@web/js/jquery.form.min.js');
AppAsset::addScript($this, '@web/js/paging.js');
AppAsset::addScript($this, '@web/js/select2.min.js');
AppAsset::addScript($this, '@web/js/projectInvestigation/assessment.js');
AppAsset::addScript($this, '@web/js/projectInvestigation/investigation.js');
AppAsset::addScript($this, '@web/js/projectInvestigation/file.js');
AppAsset::addScript	($this, '@web/js/single-project-top-img.js');
AppAsset::addScript($this, '@web/js/jquery.validate.min.js');
AppAsset::addScript($this, '@web/js/jquery.validate.extend.js');
AppAsset::addScript($this, '@web/js/messages_zh.js');
?>

<!-- 删除模态框开始（Modal） -->
<div class="container-fluid text-center project_investigation">
    <div class="row">
        <div class="modal fade" id="deleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="false">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header clearfix">
                        <div class="pull-left">
                            <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/mask.png', ['class' => 'pull-left']); ?>
                            <span class="pull-left uploadText">删除选项</span>
                        </div>
                        <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/clos.png',
                            ['class' => 'pull-right uploadImg', 'data-dismiss' => 'modal', 'aria-hidden' => 'true', 'title' => '单击关闭遮罩层', 'style' => 'margin-top: 10px; cursor: pointer;']); ?>
                    </div>
                    <div class="modal-body">
                        <p>你确定删除选中内容吗?</p>
                    </div>
                    <div class="modal-footer" style="display: block;">
                        <div class="cancelInConfirm">
                            <input id='modal-cancel' class="cancelInConfirmActive investigation_modal_delete"
                                   type="button" value="确定" data-dismiss="modal"/>
                            <input id="modal-confirm" class="active" type="button" value="取消" data-dismiss="modal"/>
                            <input type="hidden" class="model_url" value="">
                            <input type="hidden" class="model_id" value="">
                            <input type="hidden" class="model_type" value="">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="rouse_modal" data-toggle="modal" data-target="#deleModal"/>
<!--删除模态框结束-->


<!-- 图片模态框开始（Modal） -->
<div class="container-fluid text-center show_image">
    <div class="row">
        <div class="modal fade" id="imgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="false">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header clearfix">
                        <div class="pull-left">
                            <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/mask.png', ['class' => 'pull-left', 'style'=>'width: 4px; height: 16px; margin: 11px 0 0 11px;z-index: 100; background: #FFFFff;']); ?>
                            <span class="pull-left uploadText"
                                  style="margin-left: 8px; line-height38px;font-weight:bolder; font-size: 16px;color: #FFF;">查看图片</span>
                        </div>
                        <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/clos.png',
                            ['class' => 'pull-right uploadImg', 'data-dismiss' => 'modal', 'aria-hidden' => 'true', 'title' => '单击关闭遮罩层', 'style' => 'margin-top: 10px; cursor: pointer;']); ?>
                    </div>
                    <div class="modal-body">
                        <img class="modal-body-img" src="/uploads/investigation-file/FFB94995-9BBD-7EF6-5B2B-EC0B9D7042E9.jpg"/>
                    </div>
                    <div class="modal-footer" style="display: block;">
                        <div class="cancelInConfirm">
                            <input id='modal-cancel' class="cancelInConfirmActive image_show_config" type="button"
                                   value="确定" data-dismiss="modal"/>
                            <input id="modal-confirm" class="active" type="button" value="取消" data-dismiss="modal"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="show_image" data-toggle="modal" data-target="#imgModal"/>
<!--图片模态框结束-->


<a href="#" class="clicktop" title="返回顶部">
    <!--<img src="image/common/clickTop.png" alt=""  />-->
</a>

<?php echo \Yii::$app->view->renderFile('@app/views/project/project-detail-top.php',
    ['Base' => $data['Base'], 'projectModel' => $projectModel, 'packageName' => $data['packageName'], 'data' => $data, 'userChief' => $data['userChief'], 'teamInfo' => $data['teamInfo'],
        'user' => $data['user'], 'team' => $data['team'], 'teamXZR' => $data['teamXZR'], 'teamFZR' => $data['teamFZR'], 'teamZJ' => $data['teamZJ']]); ?>

<!-- 页内导航   开始-->
<div class="container edit-tabs navFix" style="z-index:2!important;">
    <div class="row">
        <div class="navFixTop"></div>
        <ul class="edit-tabs-ul1">
            <li class="pull-left edit-tabs-li1">
                <a href="<?php echo Url::toRoute(['project/getinfodata', 'package_id' => $packageId, 'project_id'
                => $projectId]); ?>">预评估信息</a>
                <!--//通过判断展示响应的ul-->
                <ul class="edit-tabs-ul2 myActiveBox" style="display: none;">
                    <li class="pull-left myActive">
                        <a href="###">基本信息</a>
                    </li>
                    <li class="pull-left prohibit">
                        <a href="###">司法进展</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">价值评估</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">补充说明</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">转让信息</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">流转、前期处置及维护情况</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">团队成员</a>
                    </li>
                </ul>
            </li>
            <!--//经过判断展示相应的的ul-->
            <li class="pull-left edit-tabs-li1  active myActiveBox">
                <!--                <a href="-->
                <?php //echo Url::toRoute(['project-investigation/index', 'package_id' => $packageId,
                //                    'project_id' => $projectId]); ?><!--">尽调报告</a>-->
                尽调报告
                <ul class="edit-tabs-ul2 zhaiQuanTable" style="display: block;">
                    <li class="pull-left myActive">
                        <a data-href="#zhaiQuan">债权基本情况</a>
                    </li>
                    <li class="pull-left">
                        <!--<li class="pull-left prohibit">-->
                        <a data-href="#jieKuan">借款人及资产情况</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#baoZheng">保证人及资产情况</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#diYa">抵押人及抵押物情况</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#qiTa">其他承债人及资产情况</a>
                    </li>
                    <li class="pull-left guanJian">
                        <a data-href="#zongJie">尽调评估总结</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#fuJian">关键附件</a>
                    </li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1 ">
                <a href="<?php echo Url::toRoute(['project/access-audit', 'package_id' => $packageId, 'project_id' =>
                    $projectId]); ?>">审核情况</a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left myActive">
                        <a href="###">访问审核情况</a>
                    </li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1 ">
                <a href="<?php echo Url::toRoute(['project-log/index', 'package_id' => $packageId, 'project_id' =>
                    $projectId]); ?>">操作日志</a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left myActive">
                        <a href="###">操作记录</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">数据更新纪录</a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</div>
<!-- 页内导航   结束-->

<!-- textarea 高度设置对比div -->
	<!--<div style="overflow: hidden;display: none;">
		<div id="d1" style="visibility:hidden;min-height: 80px;"></div>
	</div>-->

<!--债权基本情况-->
<?php echo $this->render('investigation', ['projectId' => $projectId, 'investigation' => $investigation]); ?>


<!--借款人及资产情况-->
<?php echo $this->render('stakeholder-borrower',
    ['projectId' => $projectId, 'model' => $borrower, 'lawsuitList' => $borrower_lawsuit_list]); ?>


<!--保证人及资产情况-->
<?php echo $this->render('stakeholder-warrantor',
    ['projectId' => $projectId, 'model' => $stakeholderGuarantorOne, 'list' => $guarantorList, 'lawsuitList' => $guarantor_lawsuit_list]); ?>


<!--抵押人及抵押物情况-->
<?php echo $this->render('stakeholder-pledger',
    ['projectId' => $projectId, 'model' => $stakeholderMortgagorOne, 'list' => $mortgagorList, 'lawsuitList' => $mortgagor_lawsuit_list]); ?>


<!--其他承债人及资产情况-->
<?php echo $this->render('stakeholder-other',
    ['projectId' => $projectId, 'model' => $stakeholderOtherOne, 'list' => $otherList, 'lawsuitList' => $other_lawsuit_list]); ?>


<!--尽调评估总结-->
<?php echo $this->render('summarize', ['projectId' => $projectId, 'investigation' => $investigation]); ?>


<!--关键附件-->
<?php echo $this->render('file', ['model' => $uploadImgForm, 'list' => $fileLinkPager['list'],
    'count' => $fileLinkPager['count'], 'linkPager' => $fileLinkPager['linkPager'], 'page' => $fileLinkPager['page']]); ?>


<input type="hidden" name="host" id="host" value="<?php echo Yii::$app->request->hostInfo; ?>"/>

<input type="hidden" id="init_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/init-data', true); ?>"/>

<input type="hidden" id="project_id" value="<?php echo $projectId; ?>"/>
<input type="hidden" id="package_id" value="<?php echo $packageId; ?>"/>

<input type="hidden" id="stakeholder_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/save-stakeholder', true); ?>"/>

<input type="hidden" id="stakeholder_info_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/stakeholder-info', true); ?>"/>

<input type="hidden" id="stakeholder_delete_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/delete-stakeholder', true); ?>"/>


<input type="hidden" id="lawsuit_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/save-lawsuit', true); ?>"/>

<input type="hidden" id="lawsuit_list_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/list-lawsuit', true); ?>"/>

<input type="hidden" id="lawsuit_delete_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/delete-lawsuit', true); ?>"/>

<input type="hidden" id="stakeholder_add_url"
       value="<?php echo \yii\helpers\Url::toRoute('project-investigation/add-stakeholder', true); ?>"/>

<input type="hidden" id="investigation_lock_url" value="<?php echo Url::toRoute('project-investigation/lock', true) ?>">

<input type="hidden" id="investigation_stakeholder_lock_url" value="<?php echo Url::toRoute('project-investigation/stakeholder-lock', true) ?>">

<input type="hidden" id="investigation_lawsuit_lock_url" value="<?php echo Url::toRoute('project-investigation/lawsuit-lock', true) ?>">


<input type="hidden" class="project_edit_state" value="1"/>

<?php
$js = <<<JS
    $(function() {
	     
        var project_id = $('#project_id').val(),
            package_id = $('#package_id').val();
      
        $(".like").on('click', function () {
            var value = $(this).attr('data').split('-');
            
            var url = '/project/set-project-like';
            if (value[2] == 2) {
                url = '/project/set-project-light';
            }
            $.get(url, {'project_id': project_id, 'del': value[1], 'type': value[2]}, function (res) {
                if (res.status) {
                    $("#" + value[0] + "_img").attr('src', res.img);
                    $("#" + value[0]).attr('data', value[0] + '-' + res.type + '-' + value[2]);
                    if (res.type == 1 && value[2] == 1) {
                        $('#myModalLabel').modal('show');
                    } else {
                        layer.msg(res.msg);
                    }
                } else {
                    layer.msg(res.msg);
                }
            });
       });
        
        $(document).on('click', '#getBase,#getJudicial,#getPingGu,#getExplain,#getMake,#getMain,#getTeam', (function () {
            var postionVal = $(this).data('val');
            $.get('/project/get-base-data', {
                'project_id': project_id,
                'postion': postionVal,
                'package_id': package_id
            }, function (res) {
                switch (postionVal) {
                    case 1:
                        $("#jiBenXinXiEdit").html(res);
                        $("#jiBenXinXiEdit").show();
                        $(".jiBenXinXiW").hide();
                        break;
                    case 3:
                        $(".siFaEdit").html(res);
                        $(".siFaEdit").show();
                        $(".siFaW").hide();
                        break;
                    case 5:
                        $(".jiaZhiPingGuEdit").html(res);
                        $(".jiaZhiPingGuEdit").show();
                        $(".jiaZhiPingGuW").hide();
                        break;
                    case 7:
                        $(".buChongShuoMingEdit").html(res);
                        $(".buChongShuoMingEdit").show();
                        $(".buChongShuoMingW").hide();
                        break;
                    case 9:
                        $(".zhuanRangXinXiEdit").html(res);
                        $(".zhuanRangXinXiEdit").show();
                        $(".zhuanRangXinXiW").hide();
                        break;
                    case 11:
                        $(".liuZhuanJiWieHuEdit").html(res);
                        $(".liuZhuanJiWieHuEdit").show();
                        $(".liuZhuanJiWieHuW").hide();
                        break;
                    case 13:
                        $(".tuanDuiChengYuanEdit").html(res);
                        $(".tuanDuiChengYuanEdit").show();
                        $(".tuanDuiChengYuanW").hide();
                        break;
                    default:
                        $("#jiBenXinXiEdit").html(res);
                        $("#jiBenXinXiEdit").show();
                        $(".jiBenXinXiW").hide();
                        break;
                }
            })
        }))
        
        
        
    	 //高亮显示开始
         $(document).on("focus",'textarea',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(document).on("blur",'textarea',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
		
		 $(".borderColor").on("focus",'input',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(".borderColor").on("blur",'input',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
		 $(".borderColor").on("focus",'select',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(".borderColor").on("blur",'select',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
    	//高亮显示结束
         $(document).on("focus",'textarea',function(){
			$(this).css({
						'border':'1px solid #2194f1'
			})
		})
		$(document).on("blur",'textarea',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
	      
    })
JS;
$this->registerJs($js);
?>

<?php
$cssString = <<<CSS
.wrap {
    margin-top: 134px!important;
}

.edit-tabs {
    top: 10px;
}
.zhaiQuanQingKuang {
    margin-top: 10px;
}
pre {
	font: 12px/1.5 'Microsoft YaHei','宋体', Tahoma, Arial, sans-serif;
	background: #ffffff;
	font-size: 14px;
	padding:0px!important;
	padding-top:9.5px!important;
	padding-bottom:9.5px!important;
	padding-bottom: 0px;
	border: none;
	margin:0px;
}
.modal-body .modal-body-img {
    text-align: center;
    margin: 0 auto;
}

.select2-search__field {
	height:auto!important;
}

.wrap > .container-fluid > .container{width: 100%; padding: 0; margin: 0; }

.topimg +form table tr td input[type='text'] {
	border: none!important;
}

.edit-tabs-ul1>li>a{
    display: inline-block;
    width: 105px;
    margin-left: -10px;
}

CSS;
$this->registerCss($cssString);
?>
